import { post, get } from '@/utils/request';
import type { AppRouteRecordRaw } from '@/router/routes/types';
import type { AxiosRequestConfig } from 'axios';

// 功能菜单节点接口 - 匹配实际后端数据结构
export interface FuncTreeNode {
  funcId: string;
  funcName: string;
  funcPath: string | null;
  upFuncId: string | null;
  index: number | null;
  children?: FuncTreeNode[];
}

// 后端返回的统一格式
export interface ResultBean<T> {
  code: number;
  message: string;
  data: T;
}

// 功能菜单响应数据结构
export interface FuncListResponse {
  roleIds: number;
  userName: string;
  userId: number;
  level: number | null;
  groupIds: number;
  funcList: FuncTreeNode[];
}

// 获取功能菜单列表
export function getFuncList() {
  return get<ResultBean<FuncListResponse>>('/api/funcList');
}
